package com.harboursoftware.xstorage.util;

import java.util.Collection;

import com.google.common.collect.Multimap;

public class MultimapUtils {
    /**
     * get the first value of multimap by key.
     * 
     * @param multimap
     * @param key
     * @return the value of key, or null if no contains
     */
    public static String getFirstValue(Multimap<String, String> multimap, String key) {
        Collection<String> values = multimap.get(key);
        if(!values.isEmpty()) {
            return values.iterator().next();
        }
        return null;
    }
}
